package com.example.mountain;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.widget.Toast;

public class MusicService extends Service {
	private static final String TAG = "MusicService";
	MediaPlayer player;

	public IBinder onBind(Intent intent) {
		return null;
	}

	public void onCreate() {
		player = MediaPlayer.create(this, R.raw.mosguito);
		player.setLooping(true);
	}

	public int onStartCommand(Intent intent, int flags, int startid) {
		Toast.makeText(this, "모기헌터 동작.", Toast.LENGTH_LONG)
				.show();
		player.start();
		return START_STICKY;
	}

	public void onDestroy() {
		Toast.makeText(this, "동작을 중지합니다.", Toast.LENGTH_LONG)
				.show();
		player.stop();
	}

}